home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / tsbat146.zip / REPLY.BAT < prev    next >
DOS Batch File  |  1992-02-22  |  977b  |  40 lines

  1. @echo off
  2.  
  3. echo.
  4. echo ┌────────────────────────────────────────────────────────────────────┐
  5. echo │ Demonstrate that it is possible to give input to a pure batch file │
  6. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sat 22-Feb-1992            │
  7. echo └────────────────────────────────────────────────────────────────────┘
  8. echo.
  9.  
  10. echo Give your reply as set r=YourReply terminated by ^Z (and Enter)
  11. rem Read from the keyboard into a temporary auxiliary file
  12. copy con replytmp.bat > nul
  13.  
  14. rem Set the r environment variable
  15. if exist replytmp.bat call replytmp.bat
  16.  
  17. rem Get rid of the temporary file
  18. del replytmp.bat > nul
  19.  
  20. rem Branch in accordance to the reply
  21. for %%i in (y Y yes YES) do if %%i==%r% goto _yes
  22. for %%i in (n N no NO) do if %%i==%r% goto _no
  23. goto _indef
  24.  
  25. :_yes
  26. echo Your reply was a "Yes"
  27. goto _out
  28.  
  29. :_no
  30. echo Your reply was a "No"
  31. goto _out
  32.  
  33. :_indef
  34. echo Your reply was indefinite
  35.  
  36. rem That's all folks
  37. :_out
  38. set a=
  39. echo on
  40.